/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-03-03
 * Time: 12:32
 */
public class test2 {
    /**
     * 27  移除元素
     */

    // 双指针
    public int removeElement(int[] nums, int val) {
        int left = 0;
        for(int right=0;right<nums.length;right++){
            if(nums[right]!=val){
                nums[left] = nums[right];
                left++;
            }
        }
        return left;
    }
}
